/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package exercicio_07;

import javax.swing.JOptionPane;

/**
 *
 * @author Gustavo
 */
public class Poupanca extends Conta {

    public void opcoes() {

        String opcao = JOptionPane.showInputDialog("Digite \n[1]Verificar Saldo \n[2]Verificar limite "
                + "\n[3]Realizar depósito \n[4]Realizar saques");

        switch (opcao) {
            case "1":
                JOptionPane.showMessageDialog(null, "Saldo Conta Corrente R$" + this.getSaldo());
                break;
            case "2":
                JOptionPane.showMessageDialog(null, "Limite da conta corrente R$" + this.getLimite());
                break;
            case "3":
                double deposito = Double.parseDouble(JOptionPane.showInputDialog("Informe o valor a ser depositado"));
                this.setSaldo(this.getSaldo() + deposito);
                break;
            case "4":
                double saque = Double.parseDouble(JOptionPane.showInputDialog("Informe o valor a ser sacado"));
                if (this.getSaldo() == 0 || saque > this.getSaldo()) {
                    JOptionPane.showInputDialog("Saldo insuficiente");
                } else {
                    this.setSaldo(this.getSaldo() - saque);
                }
                break;
        }
    }
}
